﻿// Copyright (c) MichaConrad. All rights reserved. See License.txt in the project root for license information.

namespace LinqToLdapExtensions.Scope
{
    using LinqToLdap;

    /// <summary>
    /// Defines the contract for implementations which know how to
    /// scope the notion of a <see cref="IDirectoryContextFactory.GetCurrentContext()">current session</see>.
    /// <br/>
    /// The notion of a contextual session is managed by some external entity
    /// (generally some form of interceptor like the HttpModule).<br/>
    /// This external manager is responsible for scoping these contextual sessions
    /// appropriately binding/unbinding them here for exposure to the application
    /// through <see cref="IDirectoryContextFactory.GetCurrentContext()"/> calls.
    /// </summary>
    /// <remarks>
    /// <para>
    /// Implementations should adhere to the following:
    /// <list type="bullet">
    /// <item><description>contain a constructor accepting a single argument of type
    /// <see cref="IDirectoryContextFactory" /></description></item>
    /// <item><description>should be thread safe</description></item>
    /// </list>
    /// </para>
    /// </remarks>
    /// <seealso cref="IDirectoryContextFactory"/>
    public interface ICurrentDirectoryContext
    {
        /// <summary>
        /// Gets the current <see cref="IDirectoryContext"/> according to the scoping defined
        /// by this implementation.
        /// </summary>
        IDirectoryContext CurrentContext { get; }
    }
}
